﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BugzX.Models.BugViewPartialViewData>" %>

<ul class="ui-widget ui-helper-clearfix">

<% foreach(var bug in this.Model.Bugs) { %>

    <% if (this.Model.IsTopLevel && bug.BugDependencies.Count > 0)
           continue; %>

    <li class="<%: (bug.BugType == BugzX.BugType.Bug) ? "bug" : "todo" %>">

        <div class="bugList" data-bugid="<%: bug.BugId %>"><a class="priority<%: bug.Priority %> <%: ((BugzX.BugStatus)bug.Status).ToString().ToLower() %>" href="#"><%: bug.Title %> - <%: bug.BugId %></a></div>

        <% if ((from b in bug.BugDependenciesParent.ToList() select b.Bug).ToList().Count > 0)
           { %>
            <% Html.RenderPartial("ViewBugsPartial", new BugzX.Models.BugViewPartialViewData()
               {
                   AddedBugId = this.Model.AddedBugId,
                   Bugs = (from b in bug.BugDependenciesParent.ToList() select b.Bug).ToList(),
                   IsTopLevel = false,
               }); %>
        <% } %>

    </li>

<% } %>

</ul>